#include "TCPClient.h"

void TCPClient_Init(TCPClient *t, const char *name, const char *address, int port)
{
    printf("[%s:%d] Init for TCPClient. Name:[%s], Address:[%s], Port:[%d]\n", __FUNCTION__, __LINE__, name, address, port);

    Network *network = SUPER_PTR(t, Network);

    network->setName(network, name);
    network->setAddress(network, address);
    network->setPort(network, port);
}

CTOR(TCPClient)
SUPER_CTOR(Network);
FUNCTION_SETTING(Init, TCPClient_Init);
END_CTOR

int main()
{
    Network *network = NULL;
    TCPClient *tcp_client = TCPClient_new();
    const char *send_data = "Hello, I am TCP Client.";

    tcp_client->Init(tcp_client, "TCPClient", "192.168.100", 10000);

    network = SUPER_PTR(tcp_client, Network);
    network->SendSync(network, send_data, strlen(send_data));
    network->SendAsync(network, send_data, strlen(send_data));

    lw_oopc_delete(tcp_client);

    return 0;
}
